<template>
    <div class="main-face">
        <div class="themeBox">
            <div class="theme">
                <DiscussTheme :ThemeTitle="title" :ThemeContent="content" :ThemeTime="themeTime" :ThemeName="name" :ThemeImgCode="themeImgCode"></DiscussTheme>
            </div>
        </div>
        <div class="box1">
            <div class="discussTitleBox">
                <div class="discussTitle">
                    <DiscussHeader></DiscussHeader>
                </div>
            </div>
            <div class="discussTextareaBox">
                <div class="discussTextarea">
                    <DiscussTextarea :SubjectId="subjectId"></DiscussTextarea>
                </div>
            </div>
            <div class="discussMainBox">
                <div class="discussMain">
                    <DiscussMain :MainParentComment="parentComment"></DiscussMain>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import DiscussTextarea from './DiscussTextarea.vue'
import DiscussMain from './DiscussMain.vue'
import DiscussHeader from './DiscussHeader.vue'
import DiscussTheme from './DiscussTheme.vue'
import instance from '@/utils/request'
import dayjs from 'dayjs'
export default {
    data(){
        return {
            title:'',
            content:'',
            themeTime:'',
            name:'',
            themeImgCode:0,
            parentComment:[],
            subjectId:null,
            comment:[],
            parentCommentText:'',
            parentCommentTime:'',
        }
    },
    components:{
        DiscussTextarea,
        DiscussMain,
        DiscussHeader,
        DiscussTheme
    },
    created(){
        this.subjectId = this.$route.params.id;
    },
    mounted(){
        instance.get(`subject/${this.subjectId}`).then(
            res=>{
                this.name=res.data.data.user.name,
                this.title=res.data.data.title,
                this.content=res.data.data.text,
                this.themeImgCode=res.data.data.user.imgCode
                this.themeTime= dayjs(res.data.data.createTime).format('YYYY-MM-DD HH:mm'),
                this.parentComment = res.data.data.commentParentList
            }
        )
    },
}
</script>

<style scoped>
    .main-face{
        width: 60vw;
        height: 100%;
        padding-top: 10px;
    }
    .main-face .box1{
        width: 100%;
        height: 100%;
        max-height: 500vh;
        margin: 10px auto;
        display: flex;
        flex-direction: column;
        background-color: #fff;
        border: none;
        border-radius: 10px;
    }
    .themeBox{
        width: 100%;
        height: auto;
        min-height: 10vh;
        background-color: #fff;
        border: none;
        border-radius: 10px;
    }
    .theme{
        width: auto;
        max-width: 80%;
        height: auto;
        padding-left: -14px;
        margin: 0 auto;
    }
    /* .box1{
        display: flex;
        flex-direction: column;
        background-color: #fff;
        margin: 10px 0;
        border: none;
        border-radius: 10px;
    } */
    .discussMainBox{
        width: 100%;
        height: auto;
        /* background-color: skyblue; */
    }
    .discussMain{
        width: auto;
        max-width: 80%;
        height: auto;
        padding-left: -14px;
        margin: 0 auto;
    }
    .discussTextareaBox{
        width: 100%;
        height: 120px;
        margin-top: 10px;
        /* background-color: pink; */
    }
    .discussTextarea{
        width: auto;
        max-width: 80%;
        margin: 0 auto;
    }
    .discussTitleBox{  
        width: 100%;
        height: 40px;
    }
    .discussTitle{
        width: auto;
        max-width: 85%;
        height: 40px;
        margin: 10px auto;
    }
</style>